import { createRouter, createWebHistory } from 'vue-router'

// import KnowledgeList from '../views/KnowledgeList.vue'
// import KnowledgeDetail from '../views/KnowledgeDetail.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'Home',
      component: () => import('@/views/Home.vue')
    },
    {
      path: '/knowledge',
      name: 'KnowledgeList',
      component: () => import('../views/Knowledge/KnowledgeList.vue') // 知识点列表页面
    },
    {
      path: '/editor',
      name: 'MarkdownEditor',
      component: () => import('../components/MarkDownEditor.vue') // 知识点列表页面
    },
    {
      path: '/knowledge/:category/:id',
      name: 'KnowledgeDetail',
      component: () => import('../views/Knowledge/KnowledgeDetail.vue'), // 知识点详情页面
      props: true // 传递 type 和 id 参数给组件
    }
    // {
    //   path: '/knowledge/:id',
    //   name: 'KnowledgeDetail',
    //   component: import('../views/Knowledge/KnowledgeDetail.vue'), // 知识点详情页面
    //   props: true // 使 id 作为 prop 传递给组件
    // }
  ]
})

export default router
